﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pout_Porri.Objects.Interface;
using Pout_Porri.Utils;

namespace Pout_Porri.Objects
{
    class Turtle : Enemy
    {
        private Animation turtlerStand;
        public string name;
        public static Turtle turtleSelected;

        public Turtle(Texture2D image, Vector2 position, Vector2 velocity, string name) : base(image, position, velocity)
        {
            this.texture = image;
            this.name = name;
        }

        public override void configAnimations()
        {
            turtlerStand = new Animation("turtlestand", new Vector2(84, 84), 600, 0, 3, 7, Axis.X);
            this.addAnimation(turtlerStand);

            this.spriteTexture = new Texture2D(Game1.graphics.GraphicsDevice, 84, 84);
           
            this.setCurrentAnimation("turtlestand");
            currentState = EnemyStates.stand;
        }

        public void HoldTurtle()
        {
            if (World.isCollisionEntity)
            {
                if (World.entityCollided is Turtle)
                {
                    Turtle t = (Turtle)World.entityCollided;

                    if (t.name == this.name)
                    {
                        turtleSelected = t;

                    }
                }
            }
            
         }

        public override void update(GameTime gameTime)
        {
            
            HoldTurtle();

            if (currentState == EnemyStates.stand)
            {
                this.setCurrentAnimation("turtlestand");
                this.currentAnimationRect = this.AnimationRect(turtlerStand);
                
            }
     
            base.update(gameTime);
        }
    }
}
